<?php
/**
 * 测试
 */
class PaijuExtTableHandler extends ScriptBase
{
    const TABLE_NAME = 'log_paiju_ext';
    public function logic()
    {
        $mysql = $this->mysql('logs');
        $nextTime =  date('Ym', strtotime('+1 month'));
        $table = self::TABLE_NAME.'_'.$nextTime;
        $hasTable = $mysql->tableExists($table); // 判断是否有该表
        $createFlag = $hasTable ? true : false;
        
        if (!$createFlag) {
            $likeTable = self::TABLE_NAME.'_'.date('Ym');
            //创建表
            $createSql = "CREATE TABLE {$table} LIKE {$likeTable}";
            $createFlag = $mysql->query($createSql);
        }
    }
}